//
//  playerView.m
//  LanQiuQuan
//
//  Created by TonyGenius on 16/4/11.
//  Copyright © 2016年 Rip. All rights reserved.
//

#import "playerView.h"


@implementation playerView

- (void)setdeTialwithbackground:(UIImage *)image PlayerNumber:(NSString *)number PlayerModel:(PlayerModel *)model andPositionNumber:(NSInteger)positionNumber
{
    self.backGroundImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height)];
    self.backGroundImage.image = image;
    
//    self.avater = [[UIImageView alloc] initWithFrame:CGRectMake(<#CGFloat x#>, <#CGFloat y#>, <#CGFloat width#>, <#CGFloat height#>)];
    
    self.number = [[UILabel alloc] init];
    self.number.text = number;
    self.number.textColor = [UIColor whiteColor];
    self.number.frame = CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height);
    self.number.textAlignment = NSTextAlignmentCenter;
    
    self.foulNumber = [[UILabel alloc] init];
    self.foulNumber.frame = CGRectMake(self.bounds.size.width - 10, 0, 10, 10);
    self.foulNumber.backgroundColor = [UIColor redColor];
    self.foulNumber.layer.masksToBounds = YES;
    self.foulNumber.layer.cornerRadius = self.foulNumber.bounds.size.width / 2.0;
    self.foulNumber.text = [NSString stringWithFormat:@"%.0f",self.playerData.personalFoul];
    self.foulNumber.font = [UIFont systemFontOfSize:10.f];
    self.foulNumber.textAlignment = NSTextAlignmentCenter;
    self.foulNumber.textColor = [UIColor whiteColor];
    
    
    self.avater.layer.masksToBounds = YES;
    self.avater.layer.cornerRadius = self.avater.bounds.size.height/2.0;
    self.positionNumber = positionNumber;
    self.isHome = NO;
    
    [self addSubview:self.backGroundImage];
    [self addSubview:self.number];
    [self addSubview:self.foulNumber];
}

- (id)initWithBackground:(UIImage *)image andPlayerNmuber:(NSString *)number andPlayerName:(NSString *)name andPosition:(NSString *)position
{
    self = [super init];
    if (self) {
//        self.playerData = [[PlayerModel alloc] initWithName:name andPosition:position];
        
        self.backGroundImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height)];
        self.backGroundImage.image = image;
        
        self.number = [[UILabel alloc] init];
        self.number.center = self.center;
        self.number.bounds = CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height);
        
        self.foulNumber = [[UILabel alloc] init];
        self.foulNumber.frame = CGRectMake(self.bounds.size.width - 40, 0, 40, 40);
        
        [self addSubview:self.backGroundImage];
        [self addSubview:self.number];
        [self addSubview:self.foulNumber];
        
        self.isHome = NO;
    }
    return self;
}




/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
